export default {
    data() {
        return {
            initActivated: false,
        };
    },
    activated() {
        if (this.initActivated) {
            this.afterActivatedReload()
        }
        this.initActivated = true
    },
    methods: {
        //在后续激活时重载数据
        afterActivatedReload() {
            if (this.getSuperTablePage()&&this.getSuperTablePage().autoLoad) {
                this.reload()
            }
        },
        //主表格方法传递
        getSuperTablePage() {
            return this.$refs['SuperTablePage']
        },

        loadData(params) {
            this.getSuperTablePage().loadData(params)
        },
        reload() {
            this.getSuperTablePage().loadData()
        },
        getData() {
            return this.getSuperTablePage() ? this.getSuperTablePage().getData() : null
        },
        getCurrentRow() {
            return this.getSuperTablePage().getCurrentRow()
        },
        getSelection() {
            return this.getSuperTablePage().getSelection()
        },
        /* 原生方法传递 */
        doLayout() {
            this.getSuperTablePage().doLayout()
        },
        setCurrentRow(row, expanded) {
            this.getSuperTablePage().setCurrentRow(row, expanded)
        },
        clearSelection() {
            this.getSuperTablePage().clearSelection()
        },

        toggleRowSelection(row, selected) {
            this.getSuperTablePage().toggleRowSelection(row, selected)
        },
        toggleAllSelection() {
            this.getSuperTablePage().toggleAllSelection()
        },
        sort(column, type) {
            this.getSuperTablePage().sort(column, type)
        },

        clearSort() {
            this.getSuperTablePage().clearSort()
        },
    }
}